package fizzbuzz;


public class FizzBuzz {
    public static String getAnwser(int number) {
        check(number);
        return computerNumber(number);
    }

    private static String computerNumber(int number) {
        if(isMultiplesOfThree(number) && isMultiplesOfFive(number)){
            return "fizzbuzz";
        }
        if(isMultiplesOfFive(number)){
            return "buzz";
        }
        if(isMultiplesOfThree(number)){
            return "fizz";
        }
        return String.valueOf(number);
    }

    private static boolean isMultiplesOfFive(int number) {
        return number % 5 == 0;
    }

    private static boolean isMultiplesOfThree(int number) {
        return number % 3 == 0;
    }

    private static void check(int number) {
        if(number < 1 || number >100){
            throw new IllegalArgumentException("输入数字小于1或者大于100");
        }
    }
}
